/*
 * TODO
 */
package com.xtrip.net.response;

import java.util.ArrayList;
import java.util.List;

import org.dom4j.Element;

import com.xtrip.net.response.TcAreaRsp.Tccounty;
import com.xtrip.util.parse.xml.XtripDocumentHelper;

/**
 * @project xtrip
 * @author shiming.yao
 * @time 2013-6-4
 */
public class TcHotelInfoRsp extends TcBaseResponse {

	private List<Hotel> list = null;
	private int totalCount = 0;
	/* (non-Javadoc)
	 * @see com.xtrip.net.response.TcBaseResponse#parseBody(org.dom4j.Element)
	 */
	@Override
	protected void parseBody(Element body) {
		// TODO Auto-generated method stub
		Element countyListEl = body.element("hotelList");
		String totCountStr = XtripDocumentHelper.getNodeAttrVal(countyListEl, "totalCount");
		if(totCountStr != null){
			setTotalCount(Integer.parseInt(totCountStr));
		}
		List<Element> countys = countyListEl.elements("hotel");
		List<TcHotel> clist = new ArrayList<TcHotel>();
		for(Element county : countys){
			List<Element> elist = county.elements();
			TcHotel t = new TcHotel();
			for(Element item : elist){
				String name = item.getName();
				String value = item.getStringValue();
				if(name.equals("id")){
					t.setId(value);
				} else if(name.equals("name")){
					t.setName(value);
				} else if(name.equals("prefixLetter")){
					t.setPrefixLetter(value);
				} else if(name.equals("enName")){
					t.setEnName(value);
				}
			}
			clist.add(t);
		}
		setList(clist);
	}
	public class TcHotel{
		private String hotelId;
		private String hotelName;
		private String cityId;
		private String cityName;
		private String sectionId;
		private String sectionName;
		private String intro;
		private String oneWord;
		private String bizSectionId;
		private String bizSectionName;
		private String address;
		private String nearBy;
		private String street;
		private String streetAddr;
		private String img;
		private String groupBuy;
		private String chainId;
		private String chainName;
		private String startRatedId;
		private String startRatedClass;
		private String startRatedName;
		private String roomType;
		private String theme;
		private String createDate;
		private String viewCount;
		private String recommendLevel;
		private String lowestPrice;
		private String highestPrice;
		private String longitude;
		private String latitude;
		private Integer commentTotal;
		private Integer commentGood;
		private Integer commentMid;
		private Integer commentBad;
		private String bonusRate;
		private List<Promotion> promotionList= null;
		private List<CP> cpList = null;
	}
	private class Promotion{
		private String id;
		private String promotion;
	}
	private class CP{
		private String point;
		private String dec;
	}
	public List<Tccounty> getList() {
		return list;
	}
	public void setList(List<Tccounty> list) {
		this.list = list;
	}
	public int getTotalCount() {
		return totalCount;
	}
	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}

}
